Add kernel iteration selection for metrix dispatch filtering#86
Open
Add kernel iteration selection for metrix dispatch filtering#86
Conversation
Adds --kernel-iteration and --kernel-iteration-range CLI options, plumbs kernel_iteration_range through the API, backends, MCP server, and rocprofv3 wrapper. Includes unit tests for YAML generation and API plumbing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds user-controlled kernel launch index selection to Metrix profiling by plumbing rocprofv3’s jobs[].kernel_iteration_range from the CLI/Python API through the backends and into the generated rocprofv3 input YAML, with corresponding unit tests and docs updates.
Changes:
- Add
--kernel-iteration Nand--kernel-iteration-range RANGECLI options and forward them throughMetrix.profile()and backend profiling. - Write
kernel_iteration_rangeinto rocprofv3 input YAMLjobsentries viaROCProfV3Wrapper. - Extend MCP server
profile_metricsto acceptkernel_filter,kernel_iteration_range, andnum_replays; add/adjust unit tests for the new plumbing.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| metrix/src/metrix/cli/main.py | Adds CLI flags for kernel iteration selection (mutually exclusive) |
| metrix/src/metrix/cli/profile_cmd.py | Resolves iteration flags into a kernel_iteration_range string and forwards to backend |
| metrix/src/metrix/api.py | Adds kernel_iteration_range to public Python API and forwards to backend |
| metrix/src/metrix/backends/base.py | Replaces old boolean flag with kernel_iteration_range and applies it during profiling replays |
| metrix/src/metrix/backends/gfx942.py | Forwards kernel_iteration_range to the rocprof wrapper |
| metrix/src/metrix/backends/gfx90a.py | Forwards kernel_iteration_range to the rocprof wrapper |
| metrix/src/metrix/profiler/rocprof_wrapper.py | Writes kernel_iteration_range into rocprofv3 input YAML jobs section |
| metrix/src/metrix/mcp/server.py | Expands MCP tool parameters to include kernel filtering/iteration and replays |
| metrix/tests/unit/test_rocprof_wrapper.py | Adds unit test ensuring YAML contains kernel_iteration_range |
| metrix/tests/unit/test_cli_parser.py | Adds unit tests for new CLI parsing and mutual exclusivity |
| metrix/tests/unit/test_api.py | Adds unit test verifying API plumbing to backend.profile |
| metrix/skill/SKILL.md | Documents new CLI options and guidance |
| metrix/README.md | Updates README with iteration semantics and CLI help text |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--kernel-iteration Nand--kernel-iteration-range RANGECLI options tometrix profilefor selecting specific kernel launch indices via rocprofv3'sjobs[].kernel_iteration_rangeYAML fieldkernel_iteration_rangethrough the Python API (Metrix.profile()), all backends (CounterBackend,GFX90a,GFX942), and the MCP serveruse_kernel_iteration_range: boolflag with user-controlledkernel_iteration_range: Optional[str]--kernelTest plan
--kernel-iteration 3correctly profiles only the 3rd launch--kernel-iteration-range [2,4]correctly profiles launches 2-4--kernel-iterationand--kernel-iteration-rangeare mutually exclusive (CLI parser test)🤖 Generated with Claude Code